<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ddd"</title>

</head>

<body>
<table width="100%" border="1" align="left" cellpadding="1" cellspacing="1">
<tr width="100%">
	<td colspan="7" bgcolor="#D3EDF6" align="center"><a href="zbx-frontend.html" title="back" target="_self">Back</a></td>
</tr>

<?php
include("inc.db.conf.php");

$query = "
SELECT
      hosts.ip, hosts.hostid, hosts.host, hosts_profiles.location
FROM
    zabbix.hosts
    INNER JOIN zabbix.items
        ON (hosts.hostid = items.hostid)
	INNER JOIN zabbix.hosts_profiles
		ON (hosts.hostid = hosts_profiles.hostid)	
    INNER JOIN zabbix.valuemaps
        ON (valuemaps.valuemapid = items.valuemapid)
    INNER JOIN zabbix.mappings
        ON (valuemaps.valuemapid = mappings.valuemapid)
    INNER JOIN zabbix.mappings AS mappings_1
        ON (valuemaps.valuemapid = mappings_1.valuemapid)
    INNER JOIN zabbix.sysmaps_elements
        ON (sysmaps_elements.elementid = hosts.hostid)
    INNER JOIN zabbix.sysmaps
        ON (sysmaps.sysmapid = sysmaps_elements.sysmapid) AND (mappings.value = items.lastvalue) AND (items.prevvalue = mappings_1.value)
WHERE   items.lastvalue LIKE '0'
        AND items.description LIKE 'ping_check'
        AND hosts.status LIKE '0'
        AND sysmaps.sysmapid LIKE '17'";

$result=mysql_query($query, $link) or die(mysql_errno($link).mysql_error($link));

while($row = mysql_fetch_array( $result )) {
echo "<tr><td width=120>".$row['ip']. "</td>
<!--http://zabbix.telsycom.local/hostprofiles.php?hostid=10414&prof_type=0-->
<td width=170><a href=http://zabbix.telsycom.local/hostprofiles.php?prof_type=0&amp;hostid=".$row['hostid'].">".$row['host']."</td>
<td width=30%>".$row['location']."</td>
<td width=100><a href=http://zabbix.telsycom.local/latest.php?open=1&amp;hostid=".$row['hostid'].">последние данные</a></td>
<td>время падения</td>
<td>2</td>
<td>3</td>
</tr>\n";
}


?>

</table>
</body>
</html>
